package cn.xinfei.xdecision.engine.runner.context;

import lombok.Getter;

import java.util.Objects;

@Getter
public enum ActionTypeEnum {
    ADD_BLACKLIST(1, "add_blacklist");

    private final Integer code;
    private final String desc;

    ActionTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ActionTypeEnum get(Integer code) {
        if (Objects.isNull(code)) {
            return null;
        }
        for (ActionTypeEnum actionTypeEnum : ActionTypeEnum.values()) {
            if (code.equals(actionTypeEnum.code)) {
                return actionTypeEnum;
            }
        }
        return null;
    }
}
